{% load adminmedia %}
{% load i18n %}
{% load thumbnail %}
{% load fb_tags %}

<tr>
    <!-- Fileselect for FileBrowseField -->
    {% ifequal query.pop '1' %}
    <td class="fb_icon">
        {% thumbnail file.path_relative settings_var.THUMBNAIL_SIZE crop as thumbnail %}
        {% if file.selectable %}
        <a href="javascript://" onclick="FileSubmit('{{ file.url_save }}', '{{ thumbnail }}', '{{ file.filetype }}');" class="fb_selectlink" title="{% trans 'Select' %}"></a>
        {% else %}
        <img src="{{ settings_var.URL_FILEBROWSER_MEDIA }}img/filebrowser_icon_select_disabled.gif" width="23" height="17" />
        {% endif %}
    </td>
    {% endifequal %}
    <!-- Fileselect for RTE/TinyMCE -->
    {% ifequal query.pop '2' %}
    <td class="fb_icon">
        {% if file.selectable %}
        <a href="javascript:FileBrowserDialogue.fileSubmit('{{ file.url_save }}');" class="fb_selectlink" title="{% trans 'Select File' %}"></a>
        {% else %}
        <img src="{{ settings_var.URL_FILEBROWSER_MEDIA }}img/filebrowser_icon_select_disabled.gif" width="23" height="17" />
        {% endif %}
    </td>
    {% endifequal %}
    <!-- Fileselect for CKeditor (former "FCKeditor") -->
    {% ifequal query.pop '3' %}
    <td class="fb_icon">
        {% if file.selectable %}
        <a href="#" onclick="OpenFile(ProtectPath('{{ file.url_save }}'));return false;" class="fb_selectlink" title="{% trans 'Select File' %}"></a>
        {% else %}
        <img src="{{ settings_var.URL_FILEBROWSER_MEDIA }}img/filebrowser_icon_select_disabled.gif" width="23" height="17" />
        {% endif %}
    </td>
    {% endifequal %}
    <!-- FileIcon -->
    <td class="fb_icon"><img src="{{ file.icon_url }}" /></td>
    <!-- Thumbnail or MakeThumbIcon -->
    {% if results_var.thumbs_total %}
    <td class="fb_icon">
        {% ifequal file.filetype 'Image' %}
        <a href="{{ file.link }}"><img src="{% thumbnail file.path_relative settings_var.THUMBNAIL_SIZE crop %}" title="{% trans 'View Image' %}" /></a>
        {% endifequal %}
    </td>
    {% endif %}
    <!-- Filename/Dimensions -->
    {% ifequal file.filetype 'Folder' %}
    <td><b><a href="{{ file.link }}/{% query_string %}">{{ file.filename }}</a></b></td>
    {% else %}
    <td><b><a href="{{ file.link }}">{{ file.filename }}</a></b>{% if file.image_dimensions %}<br /><span class="tiny">{{ file.image_dimensions.0 }} x {{ file.image_dimensions.1 }} px</span>{% endif %}</td>
    {% endifequal %}
    <!-- Image Generator -->
    {% if settings_var.USE_IMAGE_GENERATOR and results_var.generator_total %}
    <td class="fb_icon">
        {% ifequal file.filetype 'Image' %}
        {% if not file.image_is_generated %}
        <a href="generateimages/{{ file.filename }}/{% query_string %}" class="fb_imagegeneratorlink" title="{% trans 'Generate Image Versions' %}"></a>
        {% endif %}
        {% endifequal %}
    </td>
    {% endif %}
    <!-- Rename -->
    <td class="fb_icon"><a href="rename/{{ file.filename }}/{% query_string %}" class="fb_renamelink" title="{% trans 'Rename' %}"></a></td>
    <!-- Size -->
    <td>{{ file.filesize|filesizeformat }}</td>
    <!-- Date -->
    <td>{{ file.date_formatted }}</td>
    <!-- Delete -->
    {% if results_var.delete_total %}
    <td class="fb_icon">
        {% ifnotequal file.filetype 'Folder' %}
        <a href="delete/{% query_string %}&amp;filename={{ file.filename }}&amp;filetype={{ file.filetype }}" class="fb_deletelink" onclick="return confirm('{% trans "Are you sure you want to delete this file?" %}');" title="{% trans 'Delete File' %}"></a>
        {% else %}
        {% if file.folder_is_empty %}
        <a href="delete/{% query_string %}&amp;filename={{ file.filename }}&amp;filetype={{ file.filetype }}" class="fb_deletelink" onclick="return confirm('{% trans "Are you sure you want to delete this Folder?" %}');" title="{% trans 'Delete Folder' %}"></a>
        {% endif %}
        {% endifnotequal %}
    </td>
    {% endif %}
</tr>
 